package com.rockbb.common.utilities.security;

import java.awt.image.BufferedImage;
import java.util.Locale;

import com.octo.captcha.service.captchastore.FastHashMapCaptchaStore;
import com.octo.captcha.service.image.DefaultManageableImageCaptchaService;
import com.octo.captcha.service.image.ImageCaptchaService;

public class CaptchaService
{
	private static ImageCaptchaService instance = new DefaultManageableImageCaptchaService(
			new FastHashMapCaptchaStore(),
			new CaptchaImageEngine(),
			180, 100000, 75000
		);

	private CaptchaService(){}

	public static BufferedImage getImageChallenge(String sid, Locale locale)
	{
		return instance.getImageChallengeForID(sid, locale);
	}

	public static BufferedImage getImageChallenge(String sid)
	{
		return instance.getImageChallengeForID(sid);
	}

	public static boolean validate(String sid, String input)
	{
		return instance.validateResponseForID(sid, input);
	}
}
